package com.kuaiyin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kuaiyin.enums.Status;
import com.kuaiyin.enums.TestPlanExecMode;
import com.kuaiyin.sampling.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 测试计划表
 * </p>
 *
 * @author ng
 * @since 2025-04-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("test_plan")
@Schema(name = "TestPlan", description = "测试计划表")
public class TestPlan extends BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "计划ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "计划名称（唯一）")
    private String name;

    @Schema(description = "计划描述")
    private String description;

    @Schema(description = "状态：0-禁用 1-启用")
    private Status status;

    @Schema(description = "调度配置（预留）")
    private String scheduleConfig;

    @Schema(description = "超时时间（秒，0表示不限制）")
    private Integer timeout;

    @Schema(description = "最后一次执行状态")
    private String lastExecutionStatus;

    @Schema(description = "最后一次执行时间")
    private LocalDateTime lastExecutionTime;

    @Schema(description = "最后一次执行耗时（秒）")
    private Integer lastExecutionDuration;

    @Schema(description = "执行模式：STOP_ON_FAIL-错误就停止 CONTINUE_ON_FAIL-错误继续执行")
    private TestPlanExecMode execMode;
}